const URL = 'http://163.197.246.189:8080/cmc/apiv1'
export const http = (options) => {
	return new Promise((resolve, reject) => {
		uni.request({
			url: URL + options.url,
			method: options.method || "GET",
			data: options.data || {},
			success: (res) => {
				if (res.data.status == 0) {
					return uni.showToast({
						title: res.data.msg,
						icon: "none"
					})
				}
				resolve(res)
			},
			fail: (err) => {
				return uni.showToast({
					title: "网络异常",
					icon: "none"
				})
				reject(err)
			}
		})
	})
}
